import { IToolTipItem } from "../../../../com/mui/manager/IToolTipItem";
import { ToolTipsManager } from "../../../../com/mui/manager/ToolTipsManager";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { EventName } from "../../mvc/EventName";
import { GameManager } from "../../manager/GameManager";
import { ModuleType } from "../common/ModuleType";
import { DataEvent } from "../../events/DataEvent";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../extend/language/Language";
type int = number;
//class MsgTipsBtn
    
    export  class MsgTipsBtn /* flash.display.Sprite */ implements IToolTipItem
    {
        constructor()
        {
            
            buttonMode = true;
            mouseChildren = false;
            ToolTipsManager.register(this);
            this._closeIcon = GlobalClass.getBitmap(ImagesConst.TreeOpenIcon);
            this._openIcon = GlobalClass.getBitmap(ImagesConst.TreeCloseIcon);
            this.close();
            addEventListener(flash.events.MouseEvent.CLICK, this.onMouseClick);
            Dispatcher.addEventListener(EventName.SysHistoryOpen, this.onSysHistoryOpen);
            Dispatcher.addEventListener(EventName.SysHistoryClose, this.onSysHistoryClose);
            return;
        }

        /* internal  */open(): void
        {
            if (this._closeIcon.parent) 
            {
                removeChild(this._closeIcon);
            }
            if (!this._openIcon.parent) 
            {
                addChild(this._openIcon);
            }
            this._status = -1;
            this._tooltipData = MsgTipsBtn.OpenTipStr;
            return;
        }

        /* internal  */close(): void
        {
            if (this._openIcon.parent) 
            {
                removeChild(this._openIcon);
            }
            if (!this._closeIcon.parent) 
            {
                addChild(this._closeIcon);
            }
            this._status = 1;
            this._tooltipData = MsgTipsBtn.CloseTipStr;
            return;
        }

        /* internal  */onMouseClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            GameManager.instance.popupWindow(ModuleType.SysTips);
            return;
        }

        /* internal  */onSysHistoryOpen(arg1: DataEvent): void
        {
            this.open();
            return;
        }

        /* internal  */onSysHistoryClose(arg1: DataEvent): void
        {
            this.close();
            return;
        }

        public get toolTipData()
        {
            return this._tooltipData;
        }

        public set toolTipData(arg1)
        {
            this._tooltipData = arg1;
            return;
        }

        /* internal */ static /* const */OpenTipStr: string=HTMLUtil.addColor(Language.getString(20640), "#00ff00");

        /* internal */ static /* const */CloseTipStr: string=HTMLUtil.addColor(Language.getString(20641), "#00ff00");

        /* internal */ /* var */_openIcon: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_closeIcon: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_status: int;

        /* internal */ /* var */_tooltipData;
    }
